import java.io.BufferedInputStream;
import java.util.Scanner;
public class Demo17 {
     static int N = 100010;

     static int n, m;
     static int[] q = new int[N];

    public static void main(String[] args) {
        Scanner scan = new Scanner(new BufferedInputStream(System.in));
        n = scan.nextInt(); m = scan.nextInt();
        for(int i = 0; i < n; i++)q[i] = scan.nextInt();

        while(true){
            if(m-- == 0)break;
            int x = scan.nextInt();
            int l = 0, r = n - 1;
            while(l < r){
                int mid = l + r >> 1;
                if(q[mid] >= x)r = mid;
                else l = mid + 1;
            }

            if(q[l] != x)System.out.println("-1 -1");
            else{
                System.out.print(l + " ");
                int l1 = 0, r1 = n - 1;
                while(l1 < r1){
                    int mid = l1 + r1 + 1 >> 1;
                    if(q[mid] <= x)l1 = mid;
                    else r1 = mid - 1;
                }
                System.out.println(l1);
            }

        }
    }
}
